<?php
/**
* Config for ABSoft Banner module
* 
* @version 1.0
* @author trungdt
* @since Apr 2, 2011
*/

class abbannermodule_config {
	function form($object) {
		if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
		exponent_forms_initialize();

		$form = new form();
		if (!isset($object->id)) {
			$object->show_type = 0;
			$object->mwidth = 100;
			$object->mheight = 100;
			$object->rotator = 0;
			
		} else {
			
			$form->meta('id',$object->id);
		}

		$show_type_array = array(
			0=>'Text',
			1=>'Image',
			2=>'Flash',
            3=>'HTML'
		);
		
		$rotator_array = array(
			0=>'Show first item',
			1=>'Show last item',
			2=>'Show random',
			3=>'Slide from First to Last (Only Valid for Image Show Type)',
			4=>'Slide from Last to First (Only Valid for Image Show Type)',
			5=>'Slide random (Only Valid for Image Show Type)',
			6=>'First two banners image(Only Valid for Image Show Type)'
			
		);
		
		$form->register('show_type','Show type',new dropdowncontrol($object->show_type,$show_type_array));
		$form->register('mwidth','Module Width',new textcontrol($object->mwidth,50,false,100,"",true));
		$form->register('mheight','Module Height',new textcontrol($object->mheight,50,false,100,"",true));
		$form->register('rotator','Rotator',new dropdowncontrol($object->rotator,$rotator_array));
				
		$form->register('submit','',new buttongroupcontrol('Save','','Cancel'));
		return $form;
	}

	function update($values,$object) {
		$object->show_type = intval($values['show_type']);
		$object->rotator = intval($values['rotator']);
		$object->mwidth = intval($values['mwidth']);
		$object->mheight = intval($values['mheight']);
		return $object;
	}
}

?>